package com.sgb.kjwl.model.response;

/**
 * @author: 杨畔
 * @date: 2021/8/3 11:03
 * @Description: 新接口列表数据实体类
 */
public class ListResponseV1<T> {
    private T list;//列表数据
    private int pageNumber;//页码
    private int pageSize;//每页数量
    private int totalPage;//总页数
    private int totalRow;//总条数
    private boolean firstPage;//是否是第一页
    private boolean lastPage;//是否是最后一页
    //是否加载成功，默认成功
    private boolean isLoadSuccess = true;

    public ListResponseV1() {
    }

    public ListResponseV1(boolean isLoadSuccess) {
        this.isLoadSuccess = isLoadSuccess;
    }

    public ListResponseV1(boolean isLoadSuccess, int pageNumber) {
        this.isLoadSuccess = isLoadSuccess;
        this.pageNumber = pageNumber;
    }

    public T getList() {
        return list;
    }

    public void setList(T list) {
        this.list = list;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getTotalRow() {
        return totalRow;
    }

    public void setTotalRow(int totalRow) {
        this.totalRow = totalRow;
    }

    public boolean isFirstPage() {
        return firstPage;
    }

    public void setFirstPage(boolean firstPage) {
        this.firstPage = firstPage;
    }

    public boolean isLastPage() {
        return lastPage;
    }

    public void setLastPage(boolean lastPage) {
        this.lastPage = lastPage;
    }

    public boolean isLoadSuccess() {
        return isLoadSuccess;
    }

    public void setLoadSuccess(boolean loadSuccess) {
        isLoadSuccess = loadSuccess;
    }

    /**
     * 是否还有更多数据
     *
     * @return true：有更多数据 false：没有更多数据
     */
    public boolean haveMoreData() {
        return pageNumber < totalPage;
    }

    /**
     * 是否加载成功
     *
     * @return true：加载成功 false：加载失败
     */
    public boolean loadSuccess() {
        return isLoadSuccess;
    }

    /**
     * 获取下一页页码
     *
     * @return 下一页页码
     */
    public int nextPage() {
        return pageNumber + 1;
    }
}
